import { connect } from 'dva';
import React, { Component, Fragment } from 'react';
import { Steps, Button, Row, Col, Form, Input, Select, Modal, Upload, Radio, message } from 'antd';
import FUploader from './FUploader';
import AddressForm from './AddressForm';
import OtherInfo from './OtherInfo';
import OtherEdit from './OtherEdit';
const { Step } = Steps
const { Option } = Select
import styles from './index.less';

@connect(({ infoenterprise, infoaccount }) => ({
    enterpriseInfo: infoenterprise.enterpriseInfo,
    basicInfo:  infoenterprise.basicInfo,
    isEdit: infoenterprise.isEdit,
    stepNumber: infoenterprise.stepNumber, // 是否放在该组件里头？是否改变modal中state属性值时会重新渲染引用改属性的组件
    accountInfo: infoaccount.accountInfo
}))
class Enterprise extends Component {
    state = {
        isEdit: false
    }
    // 步骤 change
    handleStepChange = current => {
        const { dispatch } = this.props
        dispatch({
            type: 'infoenterprise/changeStepNumber',
            payload: {
                data: current
            }
        })
    }
    // 跳转编辑页面
    toModifyPage = ()=>{
        const { dispatch } = this.props
        dispatch({
            type: 'infoenterprise/toggleEdit',
            payload: null
        })
    }
    // 企业信息请求
    requestInfo = ()=>{
        const { dispatch } = this.props
        dispatch({
            type: 'infoenterprise/fectchInfo',
            payload: {
                data: { channel: 5, username: 'test01' }
            }
        })
    }
    // 账号信息请求 拿取供应商属性
    requestAccountInfo = ()=>{
        const { dispatch } = this.props
        dispatch({
            type: 'infoaccount/fetchInfo',
            payload: {
              data: { channel: 5, username: 'test01' }
            }
        })
    }
    // 取消
    handleCancel=()=>{
        // this.requestInfo()
        const { dispatch } = this.props
        dispatch({
            type: 'infoenterprise/toggleEdit',
            payload: null
        })
        this.forceUpdate()
    }
    // 基础信息 下一步
    nextStep = (values)=>{
        this.handleStepChange(1)
    }
    // 服务资质 上一步
    lastStep =()=>{
        this.handleStepChange(0)
    }
    // 保存  ???????
    save = (values)=>{
        console.log('save.........')
        let obj = {}
        Object.keys(values).forEach(key=>{
            if( values[key] && values[key].length > 0){
                let arr = []
                values[key].forEach(item=>{
                    arr.push(item.url)   
                })
                obj[key] = arr.toString()
            }else{
                obj[key] = ''
            }
        })
        console.log('obj....', obj)
        const {dispatch} = this.props
        dispatch({
            type: 'infoenterprise/updateInfo',
            payload: {
              data:  {...this.props.basicInfo, ...obj, id: this.props.enterpriseInfo.id, updater: 'weiwei'} 
            }
        }).then((res)=>{
            if(res.code === 200){
                dispatch({
                    type: 'infoenterprise/updateRate',
                    payload: {
                        data: this.props.enterpriseInfo.spsRateProfitResponses[0]
                    }
                })
                message.success("修改成功!")
                dispatch({
                    type: 'infoenterprise/toggleEdit',
                    payload: null
                })
                this.handleStepChange(0)
                this.requestInfo()
            }else{
                
            }
        })
    }

    componentDidMount(){
        this.requestInfo()
        this.requestAccountInfo()
        console.log('parent component did mount')
    }

    render() {
        const { isEdit, stepNumber } = this.props
        const contentCom = 
            (   stepNumber == 0 ?  
                <BasicInfo handleNext={this.nextStep} cancel={this.handleCancel}/> : 
                <ServiceQualification lastStep={this.lastStep} save={this.save}/>              
            )
        return (
            <Fragment>
                <div className={styles.companyBox}>
                    <div className={styles.btnBox}>
                        { (isEdit || stepNumber==1) ? null : <Button onClick={this.toModifyPage} type="primary" disabled={this.props.enterpriseInfo.checkState == 2} className={styles.mar}>资料更新</Button> }
                        { (isEdit || stepNumber==1 || (this.props.accountInfo.attributeTag && this.props.accountInfo.attributeTag.includes("平台供应商"))) ? null : <Button type="primary">申请成为平台供应商</Button> } 
                    </div>
                    <Steps current={stepNumber} onChange={this.handleStepChange} className={styles.stepBox} size="small">
                        <Step title="基本信息" disabled={isEdit}/>
                        <Step title="服务资质" disabled={isEdit}/>
                    </Steps>                   
                    {contentCom}
                </div>
            </Fragment>         
        )
    }
}

export default Enterprise;

/**
 * 基础信息 展示
 */
@Form.create()
@connect(({infoenterprise})=>( { 
    enterpriseInfo: infoenterprise.enterpriseInfo,
    isEdit: infoenterprise.isEdit
} ))
class BasicInfo extends Component{
    state = {
        rateData: {}
    }
    // 下一步
    handleSubmit = (e)=>{
        e.preventDefault();   
        this.props.form.validateFields((err, values) => {
            if (!err) {
                let obj = this.state.rateData
                let flag = false
                for(let key in obj){
                    if(obj[key] === ''){
                        message.warning("请填写运输服务税率")
                        flag = true
                        break
                    }
                }
                if(!flag){
                   
                    values.countryCode = values.address.countryCode
                    values.countryTwoCode = values.address.countryTwoCode
                    delete values.address
                    const { dispatch } = this.props
                    console.log('basicinfo values.....', values)
                    console.log('service rate values.....', this.state.rateData)
                    dispatch({
                        type: 'infoenterprise/modifyEnterpriseInfo',
                        payload: { ...values}
                    })
                    dispatch({
                        type: 'infoenterprise/modifyServiceRate',
                        payload: { ...this.state.rateData }
                    })
                    this.props.handleNext()
                }           
            }
        })
    }
    // 运输服务税率传值
    handleModify = (val) => {
        this.setState({
            rateData: val
        })
    }
    // 地址校验
    checkAddress = (rule, value, callback) => {
        if (value?.countryCode && value?.countryTwoCode) {
            callback()
        } else {
            callback(rule.message)
        }
    }

    render(){
        const formItemLayout = {
            labelCol: {
              xs: { span: 24 },
              sm: { span: 6 },
            },
            wrapperCol: {
              xs: { span: 24 },
              sm: { span: 14 },
            },
        }
        const { isEdit, enterpriseInfo, form } = this.props
        console.log('basicinfo rerender')
        return (
            <Form 
                {...formItemLayout} 
                onSubmit={this.handleSubmit} 
                hideRequiredMark={true}
            >
                <Row style={{padding: '0 100px'}}>
                    <Col span={12}>
                        <Form.Item label="企业全称">
                            { isEdit ? form.getFieldDecorator('corporate', {
                                    rules: [{ required: true, message: '请填写企业全称' }],
                                    initialValue: enterpriseInfo.corporate,
                                })( <Input maxLength={30} disabled={enterpriseInfo.checkState==3}/> ) : 
                                (<div>
                                    { enterpriseInfo.corporate } 
                                    {
                                        enterpriseInfo.checkState == 1 ?  
                                            <span style={{display: 'inline-block',height: '18px',lineHeight: '16px', marginLeft: '15px',color: '#f87070', border:'1px solid #f87070',fontSize: '10px',padding: '0 4px',borderRadius: '3px'}}>待提交</span> :  
                                            enterpriseInfo.checkState == 2 ? 
                                            <span style={{display: 'inline-block',height: '18px',lineHeight: '16px', marginLeft: '15px',color: '#fde2bb', border:'1px solid #fde2bb',fontSize: '10px',padding: '0 4px',borderRadius: '3px'}}>待审核</span> : 
                                            enterpriseInfo.checkState == 3 ?
                                            <span style={{display: 'inline-block',height: '18px',lineHeight: '16px', marginLeft: '15px',color: '#7edab8', border:'1px solid #7edab8',fontSize: '10px',padding: '0 4px',borderRadius: '3px'}}> 已审核</span> : null
                                    }
                                   
                                    {/* <span> 审核拒绝</span> */}
                                </div>)
                            }
                        </Form.Item>
                    </Col>
                    <Col span={12}>
                        <Form.Item label="企业简称">
                            { isEdit ? form.getFieldDecorator('itd', {
                                    rules: [{ required: true, message: '请填写企业简称'} ],
                                    initialValue: enterpriseInfo.itd,
                                })( <Input  maxLength={30}/> ) : enterpriseInfo.itd 
                            }
                        </Form.Item>                  
                    </Col>
                </Row>                  
                <Row style={{padding: '0 100px'}}>
                    <Col span={12}>
                        <Form.Item label="所在地">
                            { isEdit ? form.getFieldDecorator('address', {
                                    rules: [{ required: true, message: '请选择所在地', validator: this.checkAddress }],
                                    initialValue: {
                                        countryCode: enterpriseInfo.countryCode,
                                        countryTwoCode: enterpriseInfo.countryTwoCode,
                                    },
                                    validateTrigger: 'submit',
                                })( <AddressForm /> ) : enterpriseInfo.address 
                            }
                        </Form.Item>
                    </Col>
                    <Col span={12}>
                        <Form.Item label="法人代表">
                            { isEdit ? form.getFieldDecorator('legalPerson', {
                                    rules: [{ required: true, message: '请填写法人代表' }],
                                    initialValue: enterpriseInfo.legalPerson,
                                })( <Input maxLength={30}/> ) : enterpriseInfo.legalPerson
                            }
                        </Form.Item>                  
                    </Col>
                </Row>
                <Row style={{padding: '0 100px'}}>
                    <Col span={12}>
                        <Form.Item label="信用代码">
                            { isEdit ? form.getFieldDecorator('creditCode', {
                                    rules: [ { required: true, message: '请填写信用代码' } ],
                                    initialValue: enterpriseInfo.creditCode,
                                })( <Input  maxLength={30} disabled={enterpriseInfo.checkState==3}/> ) : enterpriseInfo.creditCode
                            }
                        </Form.Item>
                    </Col>
                    <Col span={12}>
                        <Form.Item label="一般纳税人">
                            { isEdit ? 
                                form.getFieldDecorator('generalTaxpayer', {
                                    initialValue: enterpriseInfo.generalTaxpayer || false,
                                })(
                                    <Radio.Group>
                                        <Radio value={true}>是</Radio>
                                        <Radio value={false}>否</Radio>
                                    </Radio.Group>
                                ) : enterpriseInfo.generalTaxpayer ? '是' : '否'
                            }
                        </Form.Item>                  
                    </Col>
                </Row>
                <Row style={{padding: '0 100px'}}>
                    <Col span={12}>
                        <Form.Item label="公司电话">
                            { isEdit ? form.getFieldDecorator('contactNumber', {
                                rules: [ { required: true, message: '请填写公司电话' } ],
                                    initialValue: enterpriseInfo.contactNumber
                                })( <Input maxLength={30}/> ) : enterpriseInfo.contactNumber
                            }
                        </Form.Item>
                    </Col>
                    <Col span={12}>
                        <Form.Item label="注册地址">
                            { isEdit ? form.getFieldDecorator('registeredAddress', {
                                rules: [{ required: true, message: '请填写注册地址' } ],
                                    initialValue: enterpriseInfo.registeredAddress
                                })( <Input maxLength={30}/> ) : enterpriseInfo.registeredAddress
                            }
                        </Form.Item>
                    </Col>
                </Row>    
                <Row style={{padding: '0 100px'}}>
                    <Col span={12}>
                        <Form.Item label="开户银行">
                            { isEdit ? form.getFieldDecorator('bankName', {
                                rules: [ { required: true, message: '请填写开户银行' } ],
                                    initialValue: enterpriseInfo.bankName
                                })( <Input/> ) : enterpriseInfo.bankName
                            }
                        </Form.Item>
                    </Col>
                    <Col span={12}>
                        <Form.Item label="银行账号">
                            { isEdit ? form.getFieldDecorator('bankAccountNumber', {
                                rules: [ { required: true, message: '请填写银行账号' } ],
                                    initialValue: enterpriseInfo.bankAccountNumber
                                })( <Input/> ) : enterpriseInfo.bankAccountNumber
                            }
                        </Form.Item>
                    </Col>
                </Row>
                <div style={{height: '10px',backgroundColor: '#f0f2f5'}}></div>
                <Row>              
                    {/* 表格区 */}
                    { isEdit ? <OtherEdit handleModify={this.handleModify}/> : <OtherInfo/> }

                            
                    {/* 按钮区 */}
                    {
                        isEdit ? 
                        <Row style={{display: 'flex', justifyContent: 'center', marginTop: '28px'}}>
                            <Form.Item style={{marginRight: '20px'}}>
                                <Button onClick={()=>{this.props.cancel()}}>取消</Button>
                            </Form.Item>         
                            <Form.Item>
                                <Button type="primary" htmlType="submit">下一步</Button>
                            </Form.Item>         
                        </Row> : null
                    }       
                </Row>              
            </Form>
        )
    }
}

/**
 * 基础信息 展示
 */

/**
 * 服务资质 展示 修改
 */
@Form.create()
@connect( ({infoenterprise, infoaccount}) => ( { 
    enterpriseInfo: infoenterprise.enterpriseInfo, 
    isEdit: infoenterprise.isEdit,
    accountInfo: infoaccount.accountInfo 
} ))
class ServiceQualification extends Component{
    constructor(props){
        super(props)
        const {
            imagesLicense,
            imagesLicenceAccount,
            imagesTaxpaper,
            imagesFrontCard,
            imagesBackCard,
            imagesOfficeLocation,
            imagesDangerousGoods,
            imagesRoadTransport,
            imagesQuarantine,
            imagesCustoms,
            imagesCustomsDeclaration,
            imagesOthersQualifications
        } = props.enterpriseInfo
        this.state = {
            previewVisible: false,
            previewImage: '',
            previewTitle: '',

            imagesLicense: imagesLicense ? [{uid: '1', url: imagesLicense}] : [], // 营业执照
            imagesLicenceAccount: imagesLicenceAccount ? [{uid: '1', url: imagesLicenceAccount}] : [], // 开户许可证
            imagesTaxpaper: imagesTaxpaper ? [{uid: '1', url: imagesTaxpaper}] : [], // 纳税人证明
            imagesFrontCard: imagesFrontCard ? [{uid: '1', url: imagesFrontCard}] : [], // 身份证正面
            imagesBackCard: imagesBackCard ? [{uid: '1', url: imagesBackCard}] : [], // 省份证背面
            imagesOfficeLocation: imagesOfficeLocation ? [{uid: '1', url: imagesOfficeLocation}] : [], // 办公地点图片
            imagesDangerousGoods: imagesDangerousGoods ? [{uid: '1', url: imagesDangerousGoods}] : [], // 危险品资质
            imagesRoadTransport: imagesRoadTransport ? [{uid: '1', url: imagesRoadTransport}] : [], // 道路运输许可证
            imagesQuarantine: imagesQuarantine ? [{uid: '1', url: imagesQuarantine}] : [], // 出入境检验检疫报检企业备案表
            imagesCustoms: imagesCustoms&&imagesCustoms[0].url ? imagesCustoms : [], //  报关单位注册登记证书
            imagesCustomsDeclaration: imagesCustomsDeclaration ? [{uid: '1', url: imagesCustomsDeclaration}] : [], // 报关资格证/保管人员备案证明
            imagesOthersQualifications: imagesOthersQualifications&&imagesOthersQualifications[0].url ? imagesOthersQualifications : [], // 其他资质
        }
    } 

    handleLicenseChange = (data)=>{       
        this._setFileList('imagesLicense', data)
        this.props.form.setFieldsValue({
            imagesLicense: data
        })
    }
    handleLicenceAccountChange = (data)=>{
        this._setFileList('imagesLicenceAccount', data)
        this.props.form.setFieldsValue({
            imagesLicenceAccount: data
        })
    }
    handleTaxpaperChange = (data)=>{
        this._setFileList('imagesTaxpaper', data)
        this.props.form.setFieldsValue({
            imagesTaxpaper: data
        })
    }
    handleFrontCardChange = (data)=>{
        this._setFileList('imagesFrontCard', data)
        this.props.form.setFieldsValue({
            imagesFrontCard: data
        })  
    }
    handleBackCardChange = (data)=>{
        this._setFileList('imagesBackCard', data)
        this.props.form.setFieldsValue({
            imagesBackCard: data
        })
    }
    handleOfficeLocationChange = (data)=>{
        this._setFileList('imagesOfficeLocation', data)
        this.props.form.setFieldsValue({
            imagesOfficeLocation: data
        })
    }
    handleDangerousGoodsChange = (data)=>{
        this._setFileList('imagesDangerousGoods', data)
    }
    handleRoadTransportChange = (data)=>{
        this._setFileList('imagesRoadTransport', data)
    }
    handleQuarantineChange = (data)=>{
        this._setFileList('imagesQuarantine', data)
    }
    handleCustomsChange = (data)=>{
        this._setFileList('imagesCustoms', data)
    }
    handleCustomsDeclarationChange = (data)=>{
        this._setFileList('imagesCustomsDeclaration', data)
    }
    handleOtherQualificationFile = (data)=>{
        this._setFileList('imagesOthersQualifications', data)
    }
    _setFileList(name, data){
        this.setState({
            [name]: JSON.parse(JSON.stringify(data))
        })
    }
    handleSubmit = (e)=>{
        e.preventDefault()
        const { form } = this.props      
        form.validateFields((errors, values) => {         
            if(!errors){
                const { dispatch } = this.props
                dispatch({
                    type: 'infoenterprise/modifyServiceInfo',
                    payload: { ...values }
                })
                console.log('values....', values)
                this.props.save(values)
                
            }       
        })   
    }
    submitApplication = ()=>{
        const { dispatch } = this.props
        dispatch({
            type: 'infoenterprise/enterpriseSubmit',
            payload: {data:{ id: this.props.enterpriseInfo.id}}
        }).then((res)=>{
            if(res.code == 200){
                message.success("提交成功")
            }       
        })
       
    }
    render(){
        const { 
            imagesLicense,
            imagesLicenceAccount,
            imagesTaxpaper,
            imagesFrontCard,
            imagesBackCard,
            imagesOfficeLocation,
            imagesRoadTransport,
            imagesDangerousGoods,
            imagesQuarantine,
            imagesCustoms,
            imagesCustomsDeclaration,
            imagesOthersQualifications
        } = this.state
        const {isEdit, form} = this.props
        return (
            <div className={styles.service}>
                <Form
                    layout="vertical"
                    ref={this.formRef}
                    onSubmit={this.handleSubmit}
                >
                    <Row style={{margin: '40px 0'}}>
                        <Col span={8} style={{display: 'flex',justifyContent: 'left'}}>
                            <Form.Item label="营业执照" className={styles.formwrap}>  
                                {   form.getFieldDecorator('imagesLicense', {
                                        rules: [{ required: true, message: '请上传营业执照' }],
                                        initialValue: imagesLicense,
                                    })(
                                        <FUploader num={1} mul={false} mul={false} fileList={imagesLicense} isEdit={isEdit} triggerUrlChange={this.handleLicenseChange}/>
                                    ) 
                                }                                                                             
                            </Form.Item>                                          
                        </Col>
                        <Col span={8} style={{display: 'flex',justifyContent: 'left'}}> 
                            <Form.Item label="开户许可证" className={styles.formwrap}>   
                                {   form.getFieldDecorator('imagesLicenceAccount', {
                                        rules: [{ required: true, message: '请上传开户许可证' }],
                                        initialValue: imagesLicenceAccount,
                                    })(
                                        <FUploader num={1} mul={false} fileList={imagesLicenceAccount} isEdit={isEdit} triggerUrlChange={this.handleLicenceAccountChange}/>
                                    ) 
                                }                                                     
                            </Form.Item>              
                        </Col>
                        <Col span={8} style={{display: 'flex',justifyContent: 'left'}}>
                            <Form.Item label="纳税人证明" className={styles.formwrap}>  
                                {   form.getFieldDecorator('imagesTaxpaper', {
                                        rules: [{ required: true, message: '请上传纳税人证明' }],
                                        initialValue: imagesTaxpaper,
                                    })(
                                        <FUploader num={1} mul={false} fileList={imagesTaxpaper} isEdit={isEdit} triggerUrlChange={this.handleTaxpaperChange}/>
                                    ) 
                                }                                                        
                            </Form.Item>               
                        </Col>
                    </Row>
                    <Row style={{marginBottom: '40px'}}>
                        <Col span={8} style={{display: 'flex',justifyContent: 'left'}}>
                            <Form.Item label="法人身份证正面" className={styles.formwrap}>  
                                {   form.getFieldDecorator('imagesFrontCard', {
                                        rules: [{ required: true, message: '请上传法人身份证正面' }],
                                        initialValue: imagesFrontCard,
                                    })(
                                        <FUploader num={1} mul={false} fileList={imagesFrontCard} isEdit={isEdit} triggerUrlChange={this.handleFrontCardChange}/>
                                    ) 
                                }                                      
                            </Form.Item>          
                        </Col>
                        <Col span={8} style={{display: 'flex',justifyContent: 'left'}}> 
                            <Form.Item label="法人身份证反面" className={styles.formwrap}> 
                                {   form.getFieldDecorator('imagesBackCard', {
                                        rules: [{ required: true, message: '请上传法人身份证反面' }],
                                        initialValue: imagesFrontCard,
                                    })(
                                        <FUploader num={1} mul={false} fileList={imagesBackCard} isEdit={isEdit} triggerUrlChange={this.handleBackCardChange}/>
                                    ) 
                                }                             
                            </Form.Item>              
                        </Col>
                        <Col span={8} style={{display: 'flex',justifyContent: 'left'}}>
                            <Form.Item  label="办公地点图片(带门牌以及公司抬头)" className={styles.formwrap}>
                                {   form.getFieldDecorator('imagesOfficeLocation', {
                                        initialValue: imagesOfficeLocation,
                                    })(
                                        <FUploader num={1} mul={false} fileList={imagesOfficeLocation} isEdit={isEdit} triggerUrlChange={this.handleOfficeLocationChange}/>
                                    ) 
                                }                                  
                            </Form.Item>              
                        </Col>
                    </Row>
                    <Row style={{marginBottom: '40px'}}>
                        <Col span={8} style={{display: 'flex',justifyContent: 'left'}}>
                            <Form.Item label="危险品资质" className={styles.formwrap}> 
                                {   form.getFieldDecorator('imagesDangerousGoods', {
                                        initialValue: imagesDangerousGoods,
                                    })(
                                        <FUploader num={1} mul={false} fileList={imagesDangerousGoods} isEdit={isEdit} triggerUrlChange={this.handleDangerousGoodsChange}/>
                                    ) 
                                }                                  
                            </Form.Item>          
                        </Col> 
                        <Col span={8} style={{display: 'flex',justifyContent: 'left'}}>
                            <Form.Item label="道路运输许可证" className={styles.formwrap}>
                                {   form.getFieldDecorator('imagesRoadTransport', {
                                        initialValue: imagesRoadTransport,
                                    })(
                                        <FUploader num={1} mul={false} fileList={imagesRoadTransport} isEdit={isEdit} triggerUrlChange={this.handleRoadTransportChange}/>
                                    ) 
                                }                   
                            </Form.Item>          
                        </Col> 
                        <Col span={8} style={{display: 'flex',justifyContent: 'left'}}>
                            <Form.Item label="出入境检验检疫报检企业备案表" className={styles.formwrap}>
                                {   form.getFieldDecorator('imagesQuarantine', {
                                        initialValue: imagesQuarantine,
                                    })(
                                        <FUploader num={1} mul={false} fileList={imagesQuarantine} isEdit={isEdit} triggerUrlChange={this.handleQuarantineChange}/>
                                    ) 
                                }                          
                            </Form.Item>          
                        </Col> 
                    </Row>
                    <Row style={{marginBottom: '40px'}}>
                        <Col span={16} style={{display: 'flex',justifyContent: 'left'}}>
                            <Form.Item label="报关单位注册登记证书 (最多上传三张)" className={styles.formwrapM}> 
                                {   form.getFieldDecorator('imagesCustoms', {
                                        initialValue: imagesCustoms,
                                    })(
                                        <FUploader num={3} mul={true} fileList={imagesCustoms} isEdit={isEdit} triggerUrlChange={this.handleCustomsChange}/>
                                    ) 
                                }                  
                            </Form.Item>          
                        </Col> 
                        <Col span={8} style={{display: 'flex',justifyContent: 'left'}}>
                            <Form.Item label="报关资格证/报关人员备案证明" className={styles.formwrap}> 
                                {   form.getFieldDecorator('imagesCustomsDeclaration', {
                                        initialValue: imagesCustomsDeclaration,
                                    })(
                                        <FUploader num={1} mul={false} fileList={imagesCustomsDeclaration} isEdit={isEdit} triggerUrlChange={this.handleCustomsDeclarationChange}/>
                                    ) 
                                }                               
                            </Form.Item>          
                        </Col> 
                    </Row>
                    <Row style={{marginBottom: '40px'}}>
                        <Col span={24} style={{display: 'flex',justifyContent: 'left'}}>
                            <Form.Item label="其他资质 (最多上传十张)" className={styles.formwrapM}>
                                {   form.getFieldDecorator('imagesOthersQualifications', {
                                        initialValue: imagesOthersQualifications,
                                    })(
                                        <FUploader num={10} mul={true} fileList={imagesOthersQualifications} isEdit={isEdit} triggerUrlChange={this.handleOtherQualificationFile}/>
                                    ) 
                                }                                
                            </Form.Item>          
                        </Col> 
                    </Row>                                   
                    {
                        isEdit ? ( 
                            <Form.Item>
                                <Row style={{display: 'flex',justifyContent: 'center'}}>
                                    <Button style={{marginRight: '15px'}} onClick={this.props.lastStep}>上一步</Button>
                                    <Button type="primary" style={{marginRight: '15px'}} htmlType="submit">保存</Button>
                                    {/* {
                                        // 1.专属供应商 2.自营店供应商 3.平台供应商
                                       ( this.props.accountInfo.attributeTag === '1' || this.props.accountInfo.checkState !== '1') ? null : <Button type="primary" onClick={this.submitApplication}>提交</Button>
                                    }   */}
                                    <Button type="primary" onClick={this.submitApplication}>提交</Button>                       
                                </Row>
                            </Form.Item>
                        ) : null
                    }               
                </Form>            
            </div>
        )
    }
}

